/*
  User: Yemao Luo
  Date: 2021/9/17
  Time: 14:40
*/

import java.util.Scanner;

public class Class03HW {
    public static void answer(int[] house) {
        int[] dp = new int[house.length];
        //Special Cases
        if (house.length == 1) {
            System.out.println(house[0]);
            return;
        }
        //Set simple cases
        dp[0] = house[0];
        dp[1] = Math.max(house[0], house[1]);
        //Calculate complex cases
        for (int i = 2; i < house.length; i++) {
            dp[i] = Math.max((dp[i - 2] + house[i]), dp[i - 1]);
        }
        //Output answer
        System.out.println(dp[house.length - 1]);
    }

    //Driver
    public static void main(String[] args) {
        //Set variable
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        try {
            int[] house = new int[input.length()];
            for (int i = 0; i < input.length(); i++) {
                house[i] = Integer.parseInt(String.valueOf(input.charAt(i)));
            }
            answer(house);
        }catch (Exception e){
            System.out.println("0");
        }
    }
}
